#!/bin/bash

SIZE="128 512 1024 2048 4096 8192 " #16384"
NODES="1 2 4 8 12 16 24 " #32"
#NODES="12 24"
HOSTS="creek01,creek01,creek02,creek02,creek03,creek03,creek04,creek04,creek05,creek05,creek07,creek07,creek08,creek08"
ITER=100
DELTAT=5000
OUTPUT="./output/output_runtime"
REPEAT="1 2 3 4 5 6 7 8 9 10"

if [ -f nbody ]
then
	echo "<--CLEAR-->"
	rm nbody
fi

make run
make clean

for i in $NODES
do
	echo "# start " $(date) | tee $OUTPUT$i".dat"
done

for i in $NODES
do
	for j in $SIZE
	do
		for k in $REPEAT
		do	
			echo "Nodes i " $i " Size j " $j " Repeat " $k
			mpirun -host $HOSTS -np $i ./nbody $j $ITER $DELTAT | tee -a $OUTPUT$i".dat"
		done
	done

done

for i in $NODES
do
	echo "# end " $(date) | tee -a $OUTPUT$i".dat"
done
